package mm.apk.libmm.utils

import android.util.Log
import mm.apk.libmm.BuildConfig
import mm.apk.libmm.exts.ymdhms
import java.util.*

/**
 * Descriptions：Log 工具类
 * StartVersion：
 * <p>
 * Author：ChenME
 * Date：2019-11-15
 * Email：ibelieve1210@163.com
 */
object L {

    private val DEBUG = BuildConfig.DEBUG
    private const val TAG = "ChenME"

    fun e(content: String, tag: String = "") {
        if (DEBUG) {
            Log.e(TAG, "$tag(${showNow()}) --> $content")
        }
    }

    fun w(content: String, tag: String = "") {
        if (DEBUG) {
            Log.w(TAG, "$tag(${showNow()}) --> $content")
        }
    }

    fun d(content: String, tag: String = "") {
        if (DEBUG) {
            Log.d(TAG, "$tag(${showNow()}) --> $content")
        }
    }

    fun i(content: String, tag: String = "") {
        if (DEBUG) {
            Log.i(TAG, "$tag(${showNow()}) --> $content")
        }
    }


    fun d(content: String, tr: Throwable, tag: String = "") {
        if (DEBUG) {
            Log.d(TAG, "$tag(${showNow()}) --> $content", tr)
        }
    }


    private fun showNow(): String {
        return Date().ymdhms()
    }
}